home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
resize1a
/
drawrain.frm
next >
Wrap
Text File
|
1999-09-10
|
4KB
|
145 lines
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 1620
ClientLeft = 60
ClientTop = 345
ClientWidth = 4590
LinkTopic = "Form1"
ScaleHeight = 108
ScaleMode = 3 'Pixel
ScaleWidth = 306
StartUpPosition = 3 'Windows Default
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
Height = 1575
Left = 0
ScaleHeight = 101
ScaleMode = 3 'Pixel
ScaleWidth = 301
TabIndex = 0
Top = 0
Width = 4575
Begin VB.Shape Shape1
BorderColor = &H007F7F7F&
BorderWidth = 4
Height = 855
Left = 720
Top = 240
Width = 1095
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'DrawRainBow ⌐ oigres P
'Email: oigres@postmaster.co.uk
'indented by indenter5 from www.BMSLtd.co.uk
Dim PreviousWidth As Long, PreviousHeight As Long
Dim pnt As Boolean
'draw rainbow pure colours = no grey, third colour
Private Sub Form_Load()
Show
'resize executed on startup so no need
'drawrainbow
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Static pre1 As Long
Static pre2 As Long
Static prex
Static prey
With Shape1
.Visible = False
.Top = 0 'Picture1.Top
.Left = x - 4
.Width = 8
.Height = Picture1.Height
.Visible = True
End With
r = &HFF& And Picture1.Point(x, y)
g = ShiftRight((&HFF00& And Picture1.Point(x, y)), 8)
b = ShiftRight((&HFF0000 And Picture1.Point(x, y)), 16)
Form1.Caption = "R=" & Format(Hex(r), "00") & ":G=" & Format(Hex(g), "00") & ":B=" & Format(Hex(b), "00") '& "-:-Formwidth= " & Form1.ScaleWidth
Picture1.ToolTipText = Form1.Caption
Form1.Caption = Form1.Caption & " - Resizeable Spectrum By oigres P"
End Sub
Private Function ShiftRight(x As Long, y As Long) As Long
'funct from Derek Haas
'kibblesnbits@ snip.net
ShiftRight = x \ 2 ^ y 'This shifts them
End Function
Private Sub drawrainbow()
'based on an idea I got from a part of a complicated vb prog called FireStarter
'firestarter 1999 by Nonlinear Solutions - nls@inode.at
''''Visit them at WWW.INODE.AT/NLS
'
' algorithm : split form into 6 bits
'
'Dim section As Integer
r = 255: g = 0: b = 0
'radd = 0: gadd = 0: badd = 0
cadd = 3
frmscw = Form1.ScaleWidth ' same as picture1.width
frm2 = Int((frmscw \ 6)) 'integer div; 1 6th of form1.scalewidth '(frmscw / 1535) * 6
cadd = 255 / frm2: cadd2 = 0 'cadd; colour addon ; note:255 not 256
'section = Int(((frmscw - 1) / 6))
FrmSh = Form1.ScaleHeight - 1
For x = 0 To frm2 ' section '1 6th of form size
cadd3 = Int(cadd2) ' cut off fraction for byte
clr1 = RGB(255, cadd3, 0) 'red to yellow
Picture1.Line (x, 0)-(x, FrmSh), clr1
clr2 = RGB(255 - cadd3, 255, 0) 'yellow to green
Picture1.Line (x + (frm2), 0)-(x + (frm2), FrmSh), clr2
clr3 = RGB(0, 255, cadd3) 'green to cyan
Picture1.Line (x + (frm2 * 2), 0)-(x + (frm2 * 2), FrmSh), clr3
clr4 = RGB(0, 255 - cadd3, 255) 'cyan to blue
Picture1.Line (x + (frm2 * 3), 0)-(x + (frm2 * 3), FrmSh), clr4
clr5 = RGB(cadd3, 0, 255) 'blue to magenta
Picture1.Line (x + (frm2 * 4), 0)-(x + (frm2 * 4), FrmSh), clr5
clr6 = RGB(255, 0, 255 - cadd3) 'magenta to red
Picture1.Line (x + (frm2 * 5), 0)-(x + (frm2 * 5), FrmSh), clr6
cadd2 = cadd2 + cadd 'accumulate
Next x ' each point in section
End Sub
Private Sub Form_Resize()
With Picture1
.Visible = False
.Top = 0: Picture1.Left = 0
.Width = ScaleWidth: Picture1.Height = ScaleHeight
.Visible = True
End With
drawrainbow
With Shape1
.Visible = False
.Top = 0 'Picture1.Top
'Shape1.Left = x - 4
.Width = 8
.Height = Picture1.Height
.Visible = True
End With
End Sub